home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-09-10 | 11.1 KB | 361 lines | [TEXT/MPS ] |
- (*+
- * File: UVUAssist.inc1.p
- *
- * Contains: VU assistance header - MacApp 3.0b2PQR compatible version
- *
- * Written by: David Shayer
- *
- * Copyright: © 1991 by Apple Computer, Inc., all rights reserved.
- *
- * Version: 1.0d10
- *
- * Change History (most recent first):
-
- 9/10/91 JAS indicate 3.0b2PQR compatibility, change version
- 8/21/91 JAS Change version
- 8/15/91 JAS Remove kIncludeGridItems
- 8/14/91 JAS Change CUSTOM_ITEM value to -1
- 8/13/91 JAS Add CUSTOM_ITEM, kVUAssistIdleFreq, and kIncludeGridItems definitions
- -*)
-
- {Historical Note: References to the "Mole" are equivalent to references to "Agent VU".
- "Agent VU" was previously called the "Mole".}
-
-
- { ----------------- VUAssist proc data structures --------------------}
- { The following data structures and constants are not used by the mole. They're
- defined for the benefit of the MacApp VUAssist routine. }
-
- TYPE
-
- ViewItems =
- (
- VINotMember, { not a control or dialog item }
- VIButton, { TButton - this is the first control }
- VIRadio, { TRadio }
- VICheckBox, { TCheckBox }
- VIScrollBar, { TScrollBar or TSScrollBar - this is the last control }
- VIPopup, { TPopup }
- VIStatText, { TStaticText - from here on are dialog items only}
- VIEditText, { TEditText or TNumberText }
- VIIcon, { TIcon }
- VIPicture, { TPicture }
- VITextEdit, { TTEView or TDialogTEView }
- VIGridItem { cell of a TGridView }
- );
-
-
- CONST
-
- kVUAssistIdleFreq = 1; {This is the idle frequency of VUAssist. By default this
- is set to give VUAssist a very high idle frequency. Even
- though VUAssist does nothing with this idle time, this
- ensures that SystemTask will be called frequently while
- the context of the application is the current context. In
- short, this enables Agent VU, which operates at SystemTask
- while the app's context is current, to operate at maximum
- efficiency. This maximizes V.U. performance. If, for some
- reason, you would like to let the app. sleep for longer
- periods of time, you can increase this value or, better yet,
- call gVUAssist.SetIdleFreq with the new frequency. Note,
- however, that this will cause V.U. to run more slowly against
- the application.}
-
-
- { ==================================================================}
-
- { ----------------- General Mole data structures --------------------}
- { The following data structures are used by Agent VU (the Mole). }
-
- TYPE
-
- MoleSelectors =
- (
- SStatus,
- GoOff,
- ComeOn,
- SBlock,
- PBlock,
- SBlkSize,
- SMouse,
- PMouse,
- EntKey,
- SMenuInfo,
- SMenuItems,
- SetMItemKey,
- SFrontWind,
- SFindWind,
- SWindInfo,
- SFindCtl,
- SCtlInfo,
- SFindDItem,
- SDItemInfo,
- SResPeek,
- SyncSBlock,
- SNextEvent,
- SHBlock,
- PMouseString,
- SIconHeight,
- EmptyDeferred,
- EndSelect
- );
-
- MoleError =
- (
- mNoErr,
- mUnknownSelector,
- mAlreadyOnline,
- mDeferredKilled,
- mOtherVUHost,
- mBadAddress,
- mBadHandle,
- mBadBlockSize,
- mNoKbdDrvr,
- mBigFail,
- mBadTarget,
- mNoCall,
- mNoPendingTask,
- mAppNotFound,
- mNoAppInfo,
- mDriverDeferred,
- mBadDItemIndex,
- mBadItemHdl,
- mCursBusy,
- mBadMenuRank,
- mBadMenuID,
- mBadMenuItemIndex,
- mBadLastMenuItemIndex,
- mHandleTooBig,
- mEndErr
- );
-
-
- { ----------------- Window related data structures --------------------}
-
- CONST
- { used in the valid flags field }
- { The valid flags field reflects which of the traits ( fields ) the Mole was able
- to fill in accurately. }
- VKIND = 0;
- VWRECT = 1;
- VRANK = 2;
- VFLAGS = 3;
- VVARIANT = 4;
- VCTLCOUNT = 5;
- VTITLE = 6;
- VALERTP = 7;
- VITEMCNT = 8;
- VITEMLIST = 9;
- VPART = 10;
- VKIND_MASK = $0001;
- VRECT_MASK = $0002;
- VRANK_MASK = $0004;
- VFLAGS_MASK = $0008;
- VVARIANT_MASK = $0010;
- VCTLCNT_MASK = $0020;
- VTITLE_MASK = $0040;
- VITEMCNT_MASK = $0080;
- VPART_MASK = $0100;
- VALL_W_MASK = $007F;
- VALL_D_MASK = $00FF;
-
- MWD_TITLE_LEN = 64;
-
- UNSPECIFIED_RANK = -1;
-
- TYPE
- SendFindWindowParam = Point; { point to test, in global coords }
- SendFindWindowParamPtr = ^SendFindWindowParam;
-
- DWindReqPtr = ^integer; { this isn't a real mole type, I made it up. }
-
- { This is the format of the Output buffer for SWindInfo calls. }
- MoleWindowDescriptor = RECORD
- validFlags: integer; { which of the following have valid data }
- windowKind: integer; { as in window record - standard, dialog,
- system, alert }
- portRect: Rect; { as in window's grafport }
- structRect: Rect; { boundary rect of struct rgn - global coords }
- contentRect: Rect; { boundary rect of content region - global coords }
- windowPart: integer; { returned by some calls }
- windowRank: integer; { rank in window list, 1->N }
- windowFlags: integer; { visible, hilited, go-Away, spare }
- windowVariant: integer; { variation code extracted from high byte of
- window defproc handle }
- controlCount: integer; { how many controls in the control list }
- numItems: integer; { number of items in item list }
- { The title field either has a pointer to the window title as a pascal string,
- or the text of the window title extending off into the buffer }
- CASE integer OF
- 1: (text_ptr: ^SignedByte);
- 2: (text: SignedByte);
- 3: (text_name: Str255); { this type is not defined by the mole,
- its here for the convenience of Pascal programmers,
- who can't cast anything into anything. }
- END;
- MoleWDescPtr = ^MoleWindowDescriptor;
-
-
- { ----------------- Control related data structures --------------------}
-
- CONST
-
- VCWINDOW = 0;
- VCRECT = 1;
- VCVALUE = 2;
- VCMIN = 3;
- VCMAX = 4;
- VCHILITE = 5;
- VCPART = 6;
- VCRANK = 7;
- VCTITLE = 8;
- VCWINDOWRANK_MASK = $0001;
- VCRECT_MASK = $0002;
- VCVALUE_MASK = $0004;
- VCMIN_MASK = $0008;
- VCMAX_MASK = $0010;
- VCHILITE_MASK = $0020;
- VCPART_MASK = $0040;
- VCRANK_MASK = $0080;
- VCVARIANT_MASK = $0100;
- VCTITLE_MASK = $0200;
- VALL_C_MASK = $03FF;
-
- { standard CDEF IDs }
- POPUP_CDEF = 63;
-
- TYPE
- SendFindControlParam = Point; { point to test, in global coords }
- SendFindControlParamPtr = ^SendFindControlParam;
-
- { This is the format of the Input buffer for SCtlInfo calls. }
- SendControlInfoParams = RECORD
- control_rank :integer; { rank in control list }
- window_rank :integer; { rank of owning window amongst visible windows }
- END;
- SendCtlInfoParamsPtr = ^SendControlInfoParams;
-
- { This is the format of the Output buffer for SCtlInfo calls. }
- MoleControlDescriptor = RECORD { mole control descriptor }
- validFlags :integer; { which of the following have valid data }
- owner_rank :integer; { rank of owning window amongst visible windows }
- ctlRect :Rect; { The ctl fileds are copied from the }
- ctlValue :integer; { control record }
- ctlMin :integer;
- ctlMax :integer;
- ctlHilite :integer;
- part :integer; { filled in on some calls }
- ctlRank :integer; { rank in owning window's control List }
- ctlDefID :integer; { variation code from def proc handle }
- popupMenuID :integer; { resource ID of popup menu }
- { Referring to the Note on Descriptor and Info Records above ( see Marks menu ),
- the title field either has a pointer to the control title as a pascal string,
- or the text of the control title extending off into the buffer }
- CASE integer OF
- 1: (text_ptr: ^SignedByte);
- 2: (text_buf: SignedByte);
- 3: (text_name: Str255); { this type is not defined by the mole,
- its here for the convenience of Pascal programmers. }
- END;
- MoleCDescPtr = ^MoleControlDescriptor;
-
-
- { ----------------- Dialog related data structures --------------------}
-
- CONST
- btnCtrlItem = 4;
- chkCtrlItem = 5;
- radCtrlItem = 6;
- resCtrlItem = 7;
-
- RANK_OF_THE_INVISIBLE = -2;
- CUSTOM_ITEM = -1; {special constant for items which do no fit into any
- of the other content item categories}
-
-
- TYPE
- SendDItemInfoParams = RECORD
- item_num :integer; { index in dialogs item list }
- window_rank :integer; { rank of owning window amongst visible windows }
- END;
- SendDItemInfoPtr = ^SendDItemInfoParams;
-
- MoleDItemInfo = RECORD { mole dialog item info }
- box :Rect; { item bounding box }
- ctlRank :longint; { if a control - then the control's rank in the control list }
- itemType :SignedByte; { item type }
- item_enabled :Boolean;
- has_text :Boolean;
- owner_rank :integer;
- item_num :integer;
- { Referring to the Note on Descriptor and Info Records above ( see Marks menu ),
- the itemData field either has a pointer to the control title as a pascal string,
- or the text of the control itemData extending off into the buffer, OR the
- short integer which is the resource ID of the icon or picture assocaited with
- the item. }
- CASE integer OF
- 1: (text_buf :SignedByte); { static, edit, or control title text }
- 2: (item_text_ptr :^SignedByte);
- 3: (itemResID :integer);
- 4: (text_name: Str255); { this type is not defined by the mole,
- its here for the convenience of Pascal programmers. }
- END;
- MoleDItemInfoPtr = ^MoleDItemInfo;
-
-
- { ----------------- Menu related data structures --------------------}
-
- TYPE
- SendMenuInfoParams = RECORD
- menu_rank :integer; { left-to-right rank in menu bar }
- menu_ID :integer; { ID of menu, if known }
- END;
- SendMenuInfoParamsPtr = ^SendMenuInfoParams;
-
- MoleMenuInfo = RECORD
- num_items :longint; { number of items in the menu }
- rank :longint; { in menu bar, left to right }
- left_edge :longint; { as extracted from the menu list field }
- menuID :integer; { menu ID as known to the menu manager }
- menuWidth :integer; { assuming a rectangular menu, the width in pixels
- NOT the position on the screen! }
- menuHeight :integer; { assuming a rectangular menu, the height in pixels
- NOT the position on the screen! }
- enableFlags :longint; { Least significant bit is one if the menu iteself is
- enabled. Other bits describe the enabled state of
- the first 31 items }
- { the menu field either has a pointer to the menu title as a pascal string,
- or the text of the menu title extending off into the buffer }
- CASE integer OF
- 1: (Data :^SignedByte);
- 2: (title_text :SignedByte);
- 3: (text_name: Str255); { this type is not defined by the mole,
- its here for the convenience of Pascal programmers. }
- END;
- MoleMenuInfoPtr = ^MoleMenuInfo;
-
- SendMenuItemsParams = RECORD
- menu_rank :integer; { left-to-right rank in menu bar }
- menu_ID :integer; { ID of menu, if known }
- start_item :integer; { rank of item in menu to start the block with }
- stop_item :integer; { rank of last item in the menu we are interested in }
- END;
- SendMenuItemsParamsPtr = ^SendMenuItemsParams;
-
-
-
- { ----------------- Mole data block structures --------------------}
-
- CONST
- MOLE_DATA_BLOCKSIZE = 512; { a nice, arbitrary, round number }
- ADDITIONAL_MENU_ITEM_DATA = 5; { bytes in a menu item subrec in addition to
- the text of the menu item (don't ask, its ugly) }
- TYPE
- MoleDataBlock = RECORD
- blockLength :integer; { blockLength }
- dataBlock :PACKED ARRAY [0..MOLE_DATA_BLOCKSIZE-1] OF char;
- { the returned packet will only be a long as needed to send the requested data }
- END;
- MoleDataBlockPtr = ^MoleDataBlock;
-
-